HTMLify
Check if array is sorted.cpp
Views: 2 | Author: cody
1 2 3 4 5 6 7 8 9 10 11 | class Solution { public: bool arraySortedOrNot(int arr[], int n) { for(int i=0;i<n-1;i++){ if(arr[i]>arr[i+1]){ return false; } } return true; } }; |